home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Camelot / Camelot 098 (1990-12)(Swedish User Group of Amiga)(SE)(PD)[WB].zip / Camelot 098 (1990-12)(Swedish User Group of Amiga)(SE)(PD)[WB].adf / XLisp-Stat / Book / interpolation2.lsp < prev    next >
Lisp/Scheme  |  1990-10-11  |  798b  |  30 lines

  1. ; book pp.301-302
  2.  
  3. (require "data/stackloss")
  4.  
  5. (defun standardize (x)
  6.   (let ((x-bar (mean x))
  7.         (s (standard-deviation x)))
  8.     (/ (- x x-bar) s)))
  9.  
  10. (setf std-air (standardize air))
  11. (setf std-temp (standardize temp))
  12. (setf std-conc (standardize conc))
  13. (setf std-loss (standardize loss))
  14. (setf w (plot-points (list std-air std-conc std-loss std-temp)
  15.                       :scale-type 'fixed))
  16.  
  17. (defun interpolate (p)
  18.   (let* ((alpha (* (/ pi 2) p))
  19.          (s (sin alpha))
  20.          (c (cos alpha))
  21.          (m (make-array '(4 4) :initial-element 0)))
  22.     (setf (aref m 0 0) c)
  23.     (setf (aref m 0 2) s)
  24.     (setf (aref m 1 1) c)
  25.     (setf (aref m 1 3) s)
  26.     (send w :transformation m)))
  27. (setf slider (interval-slider-dialog '(0 1) :action #'interpolate))
  28.  
  29. (send w :add-subordinate slider)
  30.